﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace updServervice
{
    class Program
    {
        private static IPAddress GroupAddress = IPAddress.Parse("224.100.0.1"); //定义组播地址
        private static int GroupPort = 11000;

        static void Main(string[] args)
        {
            UdpClient myUdpClient = new UdpClient(); //建立发送端的UdpClient实例
            IPEndPoint groupEP = new IPEndPoint(GroupAddress, GroupPort);//定义或设置IP地址与端口
            Console.WriteLine("组播发送端已经启动");
            while (true)
            {
                byte[] bytes = Encoding.UTF8.GetBytes("hello111");//将字符串转换成字节数组
                myUdpClient.Send(bytes, bytes.Length, groupEP);
                Thread.Sleep(1000);
            }

           
           
        }
    }
}
